Imports System.Windows.Forms

Public Class dlgCPass

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Dim ds As DataSet
        If txtuser.Text = "" Then
            Exit Sub
        End If

        ds = db.getvalue("select * from  users_CuChi  where userid = '" & Trim(txtuser.Text.Replace("'", "''")) & "'")
        If ds.Tables(0).Rows.Count = 0 Then
            Exit Sub
        End If
        If ds.Tables(0).Rows(0).Item("uactive") = 0 Then
            MsgBox("UserName is disabled.")
            Exit Sub
        End If
        ds = db.getvalue("select * from  users_CuChi  where userid = '" & Trim(LoginForm.userID) & "'")
        If Decode(ds.Tables(0).Rows(0).Item("upassword")) <> txtCPass.Text Then
            'MsgBox("UserID or Password is not correct")
            Exit Sub
        End If
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        txtuser.Focus()
        Me.Close()
        'Me.Dispose()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        txtuser.Focus()
        Me.Close()
        'Me.Dispose()
    End Sub

    Private Sub dlgCPass_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
        txtCPass.Text = Nothing
        txtuser.Text = Nothing

        'txtuser.Focus()
    End Sub


End Class
